<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>商品查询</title>
    <link rel="stylesheet" href="js/reset.css" />

</head>

<body>
<div class="wrap" id="app">
    <div class="search_form">
        <div class="logo"><img src="images/logo.png" alt="logo" /></div>
        <div class="form_group">
            <input
                    type="text"
                    class="input_txt"
                    placeholder="请输入查询的商品"
                    v-model="city"/>
            <button class="input_sub" @click="searchWeather">
                搜 索
            </button>
        </div>

    </div>
    <table width="300" border="1" >
        <tr>
            <td>商品名</td>
            <td>价格</td>
        </tr>
        <tr v-for="pro in products">
            <td>{{pro.pname}}</td>
            <td>{{pro.price}}</td>
        </tr>
    </table>
</div>

<script src="js/vue.js"></script>
<script src="js/axios.min.js"></script>
<script>
    let app=new Vue({
        el:"#app",
        data:{
            city:"",
            pid:{},
            products:[],
        },
        methods:{
            searchWeather(){
                axios.post("http://localhost:8080/products/list/1/10",this.pid).then(result=>{
                    this.products=result.data.data.records;
                })
            }
        }
    })
</script>



</body>
</html>